﻿@model handvn.Models.Product
@{
    ViewBag.Title = "Handvn-Quản lý sản phẩm";
    Layout = "~/Views/Shared/_Layout.cshtml";
}
<div class="tl_content_qly_prod">
@if (Request.IsAuthenticated)
{
    <h2>
        QUẢN LÝ SẢN PHẨM</h2>

    <script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>

    using (Html.BeginForm("UserEdit", "Product", FormMethod.Post, new { enctype = "multipart/form-data", id = "parentForm" }))
    {
    @Html.ValidationSummary(true)
    <fieldset>
        <legend>CHỈNH SỬA THÔNG TIN SẢN PHẨM</legend>
        @Html.HiddenFor(model => model.ProductID)
        <div class="editor-label">
            @Html.LabelFor(model => model.DetailCategoriesID, "Chi tiết danh mục")
        </div>
        <div class="editor-field">
            @Html.DropDownList("DetailCategoriesID", String.Empty)
            @Html.ValidationMessageFor(model => model.DetailCategoriesID)
        </div>
        <div class="editor-label">
            Tên sản phẩm
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.TenSanPham)
            @Html.ValidationMessageFor(model => model.TenSanPham)
        </div>
        <div class="editor-label">
            @Html.LabelFor(model => model.GiaSanPham)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.GiaSanPham)
            @Html.ValidationMessageFor(model => model.GiaSanPham)
        </div>
        <div class="editor-label">
            @Html.LabelFor(model => model.SoLuong)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.SoLuong)
            @Html.ValidationMessageFor(model => model.SoLuong)
        </div>
        
        @*<div class="editor-label">
            @Html.LabelFor(model => model.NgayNhapSanPham)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.NgayNhapSanPham)
            @Html.ValidationMessageFor(model => model.NgayNhapSanPham)
        </div>*@
        <div class="editor-label">
            @Html.LabelFor(model => model.HinhAnh)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.HinhAnh)
            @Html.ValidationMessageFor(model => model.HinhAnh)
            <input type="file" name="file" id="file"/>
        </div>
         <div class="editor-label">
            @Html.LabelFor(model => model.GioiThieu)
        </div>
          @Html.TextAreaFor(model => model.GioiThieu, new { @class="adminRichText"})
        <div class="editor-field">
           @* @Html.EditorFor(model => model.GioiThieu)*@
            @Html.ValidationMessageFor(model => model.GioiThieu)
        </div>
        <script language="javascript" type="text/javascript">
            jQuery(".adminRichText").ckeditor();
</script>
        @*<div class="editor-label">
            @Html.LabelFor(model => model.UserID, "User")
        </div>
        <div class="editor-field">
            @Html.DropDownList("UserID", String.Empty)
            @Html.ValidationMessageFor(model => model.UserID)
        </div>*@
         @Html.HiddenFor(model => model.UserID)
         @Html.HiddenFor(model => model.SoLuotXem)
         @Html.HiddenFor(model => model.NgayNhapSanPham)
        @*<div class="editor-label">
            @Html.LabelFor(model => model.TinhTrang)
        </div>*@
        <div class="editor-field">
            @*@Html.EditorFor(model => model.TinhTrang)*@
            @Html.HiddenFor(model => model.TinhTrang)
            @Html.ValidationMessageFor(model => model.TinhTrang)
        </div>
            <input class="tl_btn" type="submit" value="LƯU LẠI" />
    </fieldset>
    }
    <div>
        @Html.ActionLink("Quay về", "UserView", new { UserID = @Session["UserId"] })
    </div>

}
else
{
    <div class="tl_content" style="text-align:center">
    <p>
         XIN VUI LÒNG ĐĂNG NHẬP</p>
    @Html.ActionLink("Đăng nhập", "Login", "Account")
    </div>
}
 </div>